//
// Decompiled with: Decompiler.NET, Version=1.3.1.18439, Culture=neutral, PublicKeyToken=null, Version: 1.3.1.18439
// Decompilation Started at: 3/15/2009 10:34:26 PM
// Copyright 2003 - 2004, Jungle Creatures, Inc., All Rights Reserved. 
// Written by Jonathan Pierce, Email: support@junglecreatures.com
//

namespace PatientManagement

{
		
		#region Namespace Import Declarations
		
			using System.ComponentModel;
			using System.Data.Common;
			using System.Data;
			using System.Data.SqlClient;
			using System.Drawing;
			using System;
			using System.Windows.Forms;
			
		#endregion
		
	public class frmTienIch : Form
	
	{
		
		#region Fields
			private Button btLuuLK;
			private Button btLuuPT;
			private Button btLuuTT;
			private Button btThoatLK;
			private Button btThoatPT;
			private Button btThoatTT;
			private Container components;
			private string connStr;
			private DataGrid dgLoiKhuyen;
			private DataGrid dgPhauThuat;
			private DataGrid dgThuThuat;
			public int flag;
			private TabControl tabControl1;
			private TabPage tpLoiKhuyen;
			private TabPage tpPhauThuat;
			private TabPage tpThuThuat;
		#endregion
		
		#region Constructors
		
			public frmTienIch ()
			
			{
				this.connStr = Connection.ConnectionString ();
				this.components = ((System.ComponentModel.Container) null);
				this.flag = 1;
				this.InitializeComponent ();
				return;
			}
			
		#endregion
		
		#region Methods
		
			private void btLuuLK_Click (object sender, EventArgs e)
			
			{
				this.updateData (this.dgLoiKhuyen, "Delete Advice", "Advice(advDoctorAdvice)", 200);
				this.loadData (this.dgLoiKhuyen, "Advice", "Select * from Advice", "advISN", "                          L?i Khuy?n");
				return;
			}
			
			private void btLuuPT_Click (object sender, EventArgs e)
			
			{
				this.updateData (this.dgPhauThuat, "Delete Surgical", "Surgical(surName)", 100);
				this.loadData (this.dgPhauThuat, "Surgical", "Select * from Surgical", "surISN", "                          Ph?u Thu?t");
				return;
			}
			
			private void btLuuTT_Click (object sender, EventArgs e)
			
			{
				this.updateData (this.dgThuThuat, "Delete TreatmentSkill", "TreatmentSkill(trsSkillName)", 100);
				this.loadData (this.dgThuThuat, "TreatmentSkill", "Select * from TreatmentSkill", "trsISN", "                          Th? Thu?t");
				return;
			}
			
			private void btThoatLK_Click (object sender, EventArgs e)
			
			{
				base.Close ();
				return;
			}
			
			private void btThoatPT_Click (object sender, EventArgs e)
			
			{
				base.Close ();
				return;
			}
			
			private void btThoatTT_Click (object sender, EventArgs e)
			
			{
				base.Close ();
				return;
			}
			
			protected override void Dispose (bool disposing)
			
			{
				this.flag = 0;
				if (! disposing)
				{
					goto L_001D;
				}
				if (this.components == null)
				{
					goto L_001D;
				}
				this.components.Dispose ();
				
			L_001D:
				
				{
				}
				base.Dispose (disposing);
				return;
			}
			
			private void draw_DataGrid (DataGrid Value1, string Value2, string Value3)
			
			{
				DataGridTableStyle theDataGridTableStyle;
				DataGridTextBoxColumn theDataGridTextBoxColumn;
				DataGridTextBoxColumn theDataGridTextBoxColumn2;
				theDataGridTableStyle = new DataGridTableStyle ();
				theDataGridTableStyle.MappingName = Value2;
				theDataGridTableStyle.RowHeadersVisible = false;
				theDataGridTableStyle.AlternatingBackColor = Color.AliceBlue;
				theDataGridTableStyle.HeaderForeColor = Color.Maroon;
				theDataGridTableStyle.GridLineColor = Color.CornflowerBlue;
				theDataGridTextBoxColumn = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn.MappingName = ((DataSet) Value1.DataSource).Tables[0].Columns[0].ColumnName.ToString ();
				theDataGridTextBoxColumn.HeaderText = "  STT";
				theDataGridTextBoxColumn.Width = 50;
				theDataGridTextBoxColumn.NullText = string.Empty;
				theDataGridTextBoxColumn.ReadOnly = true;
				theDataGridTextBoxColumn.Alignment = HorizontalAlignment.Center;
				int i = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn));
				theDataGridTextBoxColumn2 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn2.MappingName = ((DataSet) Value1.DataSource).Tables[0].Columns[1].ColumnName.ToString ();
				theDataGridTextBoxColumn2.HeaderText = Value3;
				theDataGridTextBoxColumn2.Width = 500;
				theDataGridTextBoxColumn2.NullText = string.Empty;
				int i2 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn2));
				theDataGridTableStyle.AllowSorting = false;
				Value1.TableStyles.Clear ();
				int i3 = Value1.TableStyles.Add (theDataGridTableStyle);
				return;
			}
			
			private void frmTienIch_Load (object sender, EventArgs e)
			
			{
				this.loadData (this.dgThuThuat, "TreatmentSkill", "Select * from TreatmentSkill", "trsISN", "                                         Th? Thu?t");
				this.loadData (this.dgPhauThuat, "Surgical", "Select * from Surgical", "surISN", "                                         Ph?u Thu?t");
				this.loadData (this.dgLoiKhuyen, "Advice", "Select * from Advice", "advISN", "                                         L?i Khuy?n");
				return;
			}
			
			private void InitializeComponent ()
			
			{
				Control[] theControlArray;
				Control[] theControlArray2;
				Control[] theControlArray3;
				Control[] theControlArray4;
				Control[] theControlArray5;
				this.tabControl1 = new TabControl ();
				this.tpThuThuat = new TabPage ();
				this.dgThuThuat = new DataGrid ();
				this.btLuuTT = new Button ();
				this.btThoatTT = new Button ();
				this.tpPhauThuat = new TabPage ();
				this.dgPhauThuat = new DataGrid ();
				this.btLuuPT = new Button ();
				this.btThoatPT = new Button ();
				this.tpLoiKhuyen = new TabPage ();
				this.dgLoiKhuyen = new DataGrid ();
				this.btLuuLK = new Button ();
				this.btThoatLK = new Button ();
				this.tabControl1.SuspendLayout ();
				this.tpThuThuat.SuspendLayout ();
				((ISupportInitialize) this.dgThuThuat).BeginInit ();
				this.tpPhauThuat.SuspendLayout ();
				((ISupportInitialize) this.dgPhauThuat).BeginInit ();
				this.tpLoiKhuyen.SuspendLayout ();
				((ISupportInitialize) this.dgLoiKhuyen).BeginInit ();
				base.SuspendLayout ();
				theControlArray = new Control[3];
				theControlArray[0] = ((Control) this.tpThuThuat);
				theControlArray[1] = ((Control) this.tpPhauThuat);
				theControlArray[2] = ((Control) this.tpLoiKhuyen);
				this.tabControl1.Controls.AddRange (theControlArray);
				this.tabControl1.Dock = DockStyle.Fill;
				this.tabControl1.Name = "tabControl1";
				this.tabControl1.SelectedIndex = 0;
				this.tabControl1.Size = new System.Drawing.Size (560, 445);
				this.tabControl1.TabIndex = 0;
				theControlArray2 = new Control[3];
				theControlArray2[0] = ((Control) this.dgThuThuat);
				theControlArray2[1] = ((Control) this.btLuuTT);
				theControlArray2[2] = ((Control) this.btThoatTT);
				this.tpThuThuat.Controls.AddRange (theControlArray2);
				this.tpThuThuat.Location = new Point (4, 25);
				this.tpThuThuat.Name = "tpThuThuat";
				this.tpThuThuat.Size = new System.Drawing.Size (552, 416);
				this.tpThuThuat.TabIndex = 0;
				this.tpThuThuat.Text = "Th? Thu?t";
				this.dgThuThuat.BackgroundColor = SystemColors.Window;
				this.dgThuThuat.CaptionVisible = false;
				this.dgThuThuat.DataMember = "";
				this.dgThuThuat.HeaderForeColor = SystemColors.ControlText;
				this.dgThuThuat.Name = "dgThuThuat";
				this.dgThuThuat.Size = new System.Drawing.Size (555, 368);
				this.dgThuThuat.TabIndex = 1;
				this.btLuuTT.Location = new Point (184, 376);
				this.btLuuTT.Name = "btLuuTT";
				this.btLuuTT.Size = new System.Drawing.Size (88, 32);
				this.btLuuTT.TabIndex = 0;
				this.btLuuTT.Text = "L?u";
				this.btLuuTT.Click += new EventHandler (this.btLuuTT_Click);
				this.btThoatTT.Location = new Point (288, 376);
				this.btThoatTT.Name = "btThoatTT";
				this.btThoatTT.Size = new System.Drawing.Size (88, 32);
				this.btThoatTT.TabIndex = 0;
				this.btThoatTT.Text = "Tho?t";
				this.btThoatTT.Click += new EventHandler (this.btThoatTT_Click);
				theControlArray3 = new Control[3];
				theControlArray3[0] = ((Control) this.dgPhauThuat);
				theControlArray3[1] = ((Control) this.btLuuPT);
				theControlArray3[2] = ((Control) this.btThoatPT);
				this.tpPhauThuat.Controls.AddRange (theControlArray3);
				this.tpPhauThuat.Location = new Point (4, 22);
				this.tpPhauThuat.Name = "tpPhauThuat";
				this.tpPhauThuat.Size = new System.Drawing.Size (552, 419);
				this.tpPhauThuat.TabIndex = 1;
				this.tpPhauThuat.Text = "Ph?u Thu?t";
				this.dgPhauThuat.BackgroundColor = SystemColors.Window;
				this.dgPhauThuat.CaptionVisible = false;
				this.dgPhauThuat.DataMember = "";
				this.dgPhauThuat.HeaderForeColor = SystemColors.ControlText;
				this.dgPhauThuat.Name = "dgPhauThuat";
				this.dgPhauThuat.Size = new System.Drawing.Size (555, 368);
				this.dgPhauThuat.TabIndex = 4;
				this.btLuuPT.Location = new Point (184, 376);
				this.btLuuPT.Name = "btLuuPT";
				this.btLuuPT.Size = new System.Drawing.Size (88, 32);
				this.btLuuPT.TabIndex = 3;
				this.btLuuPT.Text = "L?u";
				this.btLuuPT.Click += new EventHandler (this.btLuuPT_Click);
				this.btThoatPT.Location = new Point (288, 376);
				this.btThoatPT.Name = "btThoatPT";
				this.btThoatPT.Size = new System.Drawing.Size (88, 32);
				this.btThoatPT.TabIndex = 2;
				this.btThoatPT.Text = "Tho?t";
				this.btThoatPT.Click += new EventHandler (this.btThoatPT_Click);
				theControlArray4 = new Control[3];
				theControlArray4[0] = ((Control) this.dgLoiKhuyen);
				theControlArray4[1] = ((Control) this.btLuuLK);
				theControlArray4[2] = ((Control) this.btThoatLK);
				this.tpLoiKhuyen.Controls.AddRange (theControlArray4);
				this.tpLoiKhuyen.Location = new Point (4, 22);
				this.tpLoiKhuyen.Name = "tpLoiKhuyen";
				this.tpLoiKhuyen.Size = new System.Drawing.Size (552, 419);
				this.tpLoiKhuyen.TabIndex = 2;
				this.tpLoiKhuyen.Text = "L?i Khuy?n";
				this.dgLoiKhuyen.BackgroundColor = SystemColors.Window;
				this.dgLoiKhuyen.CaptionVisible = false;
				this.dgLoiKhuyen.DataMember = "";
				this.dgLoiKhuyen.HeaderForeColor = SystemColors.ControlText;
				this.dgLoiKhuyen.Name = "dgLoiKhuyen";
				this.dgLoiKhuyen.Size = new System.Drawing.Size (555, 368);
				this.dgLoiKhuyen.TabIndex = 4;
				this.btLuuLK.Location = new Point (184, 376);
				this.btLuuLK.Name = "btLuuLK";
				this.btLuuLK.Size = new System.Drawing.Size (88, 32);
				this.btLuuLK.TabIndex = 3;
				this.btLuuLK.Text = "L?u";
				this.btLuuLK.Click += new EventHandler (this.btLuuLK_Click);
				this.btThoatLK.Location = new Point (288, 376);
				this.btThoatLK.Name = "btThoatLK";
				this.btThoatLK.Size = new System.Drawing.Size (88, 32);
				this.btThoatLK.TabIndex = 2;
				this.btThoatLK.Text = "Tho?t";
				this.btThoatLK.Click += new EventHandler (this.btThoatLK_Click);
				this.AutoScaleBaseSize = new System.Drawing.Size (7, 16);
				base.ClientSize = new System.Drawing.Size (560, 445);
				theControlArray5 = new Control[1];
				theControlArray5[0] = ((Control) this.tabControl1);
				base.Controls.AddRange (theControlArray5);
				this.Font = new System.Drawing.Font ("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte) byte.MinValue));
				base.Name = "frmTienIch";
				base.StartPosition = FormStartPosition.CenterScreen;
				this.Text = "L?i Khuy?n - Th? Thu?t - Ph?u Thu?t";
				base.Load += new EventHandler (this.frmTienIch_Load);
				this.tabControl1.ResumeLayout (false);
				this.tpThuThuat.ResumeLayout (false);
				((ISupportInitialize) this.dgThuThuat).EndInit ();
				this.tpPhauThuat.ResumeLayout (false);
				((ISupportInitialize) this.dgPhauThuat).EndInit ();
				this.tpLoiKhuyen.ResumeLayout (false);
				((ISupportInitialize) this.dgLoiKhuyen).EndInit ();
				base.ResumeLayout (false);
				return;
			}
			
			private void loadData (DataGrid Value1, string Value2, string Value3, string Value4, string Value5)
			
			{
				SqlConnection theSqlConnection;
				SqlDataAdapter theSqlDataAdapter;
				DataSet theDataSet;
				int i;
				theSqlConnection = new SqlConnection (this.connStr);
				theSqlDataAdapter = new SqlDataAdapter (Value3, theSqlConnection);
				theDataSet = new DataSet ();
				int i2 = theSqlDataAdapter.Fill (theDataSet, Value2);
				theSqlDataAdapter.Dispose ();
				if ((theDataSet != null) && ((theDataSet.Tables.Count != 0) && (theDataSet.Tables[Value2].Rows.Count != 0)))
				{
					goto L_0053;
				}
				
			L_0051:
				
				{
				}
				goto L_009A;
				
			L_0053:
				
				{
				}
				i = 0;
				goto L_0081;
				
			L_0057:
				
				{
				}
				theDataSet.Tables[Value2].Rows[i][Value4] = (i + 1);
				i++;
				
			L_0081:
				
				{
				}
				if (i < theDataSet.Tables[Value2].Rows.Count)
				{
					goto L_0057;
				}
				
			L_009A:
				
				{
				}
				Value1.DataSource = null;
				Value1.SetDataBinding (theDataSet, Value2);
				this.draw_DataGrid (Value1, Value2, Value5);
				return;
			}
			
			private void updateData (DataGrid Value1, string Value2, string Value3, int Value4)
			
			{
				SqlConnection theSqlConnection;
				SqlCommand theSqlCommand;
				DataSet theDataSet;
				int i;
				SqlCommand theSqlCommand2;
				if ((Value1.DataSource != null) && (((DataSet) Value1.DataSource).Tables[0].Rows.Count != 0))
				{
					goto L_002F;
				}
				
			L_002A:
				
				{
				}
				goto L_015D;
				
			L_002F:
				
				{
				}
				theSqlConnection = new SqlConnection (this.connStr);
				theSqlCommand = new SqlCommand (Value2, theSqlConnection);
				theSqlCommand.Connection.Open ();
				int i2 = theSqlCommand.ExecuteNonQuery ();
				theSqlCommand.Connection.Close ();
				theDataSet = ((DataSet) Value1.DataSource);
				i = 0;
				goto L_012E;
				
			L_0073:
				
				{
				}
				if (theDataSet.Tables[0].Rows[i][1].ToString () == "")
				{
					goto L_012A;
				}
				theSqlCommand2 = new SqlCommand (string.Concat ("Insert ", Value3, " values(@param)"), theSqlConnection);
				SqlParameter theSqlParameter = theSqlCommand2.Parameters.Add ("@param", SqlDbType.NVarChar, Value4);
				theSqlCommand2.Parameters["@param"].Value = theDataSet.Tables[0].Rows[i][1].ToString ();
				theSqlCommand2.Connection.Open ();
				int i3 = theSqlCommand2.ExecuteNonQuery ();
				theSqlCommand2.Connection.Close ();
				
			L_012A:
				
				{
				}
				i++;
				
			L_012E:
				
				{
				}
				if (i < theDataSet.Tables[0].Rows.Count)
				{
					goto L_0073;
				}
				DialogResult theDialogResult = MessageBox.Show ("?? l?u th?nh c?ng.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				
			L_015D:
				return;
			}
			
		#endregion
	}
	
}

